/**
 * This file is part of Wireless TransFer.
 *
 *   Wireless TransFer is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *	
 *   Wireless TransFer is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with Wireless TransFer.  If not, see <http://www.gnu.org/licenses/>.
 *	 
 *	 Copyright (C) 2011
 *   @author christofferP
 */
package com.wirelesstransfer.server;

import com.wirelesstransfer.connection.IConnection;

/**
 * Singelton ServerConnection instance, holds information about the server
 * @author christofferP
 *
 */

public final class ServerConnection implements IConnection {

	private String ipAddress;
	private int port;
	private int code;

	private static ServerConnection conn;

	private ServerConnection(String ipAddress, int port, int code){
		this.ipAddress = ipAddress;
		this.port = port;
		this.code = code;
	}

	/**
	 * Sets the instance of the server
	 * @param ipAddress to this server
	 * @param port to this server
	 * @param code to authtenticate this server
	 */
	public static void setInstance(String ipAddress, int port, int code){
			conn = new ServerConnection(ipAddress, port, code);
	}
	
	/**
	 * singelton
	 * @return current ServerConnection instance
	 */
	public static ServerConnection getInstance(){
		return conn;
	}

	public String getIP() {
		return ipAddress;
	}

	public int getPort() {
		return port;
	}

	public int getCode() {
		return code;
	}

}
